<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    //首页
    public function index(){
        $this->assign('URL_PREFIX',C("URL_PREFIX"));
        $this->display(T('Index/About/index'));
    }
    //about me
    public function aboutMe(){
        $this->assign('URL_PREFIX',C("URL_PREFIX"));
        $this->display(T('Index/About/index'));
    }
    //发送邮件
    public function sendMessage(){
        $Form   =   D('email_message');
        if($Form->create()) {
            $satus = SendMail($_POST['email'],$_POST['name'],$_POST['message']);
            if($satus) $Form->status = 1;
            $result =   $Form->add();
            if($result) {
                $this->success('Success');
            }else{
                $this->error('Error');
            }
        }else{
             $this->error($Form->getError());
        }
    }
    //获取blog摘要信息（最新五个）
    public function getBlog(){
        $Form = M("blog");
        $data = $Form->where('"delete" = 0')->order('create_time desc')->limit(5)->select();
        $this->ajaxReturn($data);
    }
}